package com.yanjin.dao;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jdbc.tool.DBLianjie;

public class QianTaiGeRen extends HttpServlet {

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		String userid=request.getParameter("userId");
		String username=request.getParameter("username");
		String passWord=request.getParameter("userpass");
		String sex=request.getParameter("sex");
		
		String birthyear=request.getParameter("birthyear");
		String birthmonth=request.getParameter("birthmonth");
		String birthday=request.getParameter("birthday");
		String brithDay=birthyear+"-"+birthmonth+"-"+birthday;	
		brithDay="19"+brithDay;		
  	  String userCarid=request.getParameter("userCarid");
	  String email=request.getParameter("email");
	  String pone=request.getParameter("pone");
	  String addres=request.getParameter("addres");
	  String beizhu=request.getParameter("beizhu");
		
		Connection conn=null;
		Statement stm=null;
		String sql="update emai_user set E_USER_ID='"+userid+"',E_USER_NAME='"+username+"',E_PASSWORD='"+passWord+"',E_SEX='"+sex+"',E_BRITHDAY=to_date('"+brithDay+"','yy-MM-dd'),E_IDENTITY_CODE='"+userCarid+"',E_EMIAL='"+email+"',E_MOBILE='"+pone+"',E_ADDRESS='"+addres+"',E_LJ='"+beizhu+"' where e_user_id='"+userid+"'";
        conn=DBLianjie.getconn();
       try {
		stm=conn.createStatement();
		boolean x=stm.execute(sql);

		if(!x){
			response.sendRedirect("./qiantai/main.jsp");
		}else{
		}
	} catch (SQLException e) {
		e.printStackTrace();
	}
	}

}
